/**************************************************************
Arise Engine		SceneObject.h

					E-mail:	arise_engine@mail.ru

created:			10.09.2005
last changes:		12.09.2007
**************************************************************/
#pragma once

#include "..\engine\BaseObject.h" 
#include "TransformationNode.h"


#define SCENE_OBJECT_TYPE_UNKNOWN			(__int16)0x5000
#define SCENE_OBJECT_TYPE_GRAFIC_OBJECT		(__int16)0x5001
#define SCENE_OBJECT_TYPE_SECTOR			(__int16)0x5002
#define SCENE_OBJECT_TYPE_PORTAL			(__int16)0x5003
#define SCENE_OBJECT_TYPE_RESPAWN_POINT		(__int16)0x5004
#define SCENE_OBJECT_TYPE_PHYSIC_OBJECT		(__int16)0x5005



class SceneObject: public BaseObject
{
private:

	__int16			m_type;
	__int16			m_parent_type;
	//SceneObject*	m_parent;

public:
	SceneObject();
	virtual ~SceneObject();

	TransformationNode			m_transformation_node;	
	std::string					m_parent_node_name;
	std::vector<SceneObject*>	m_children;

	void Init();
	void Update();
	void Release();
	
	void Attach(SceneObject* child);
	void Detach(SceneObject* child);
	void ApplyTransformation(const D3DXMATRIXA16 &transformation);
	
	void SetParentType(__int16 type)		{m_parent_type = type;}
	void SetSceneObjectType(__int16 type)	{m_type = type;}
	void SetTransformationNode(const TransformationNode& tm_node){m_transformation_node = tm_node;}

	__int16				GetSceneObjectType() const	{return m_type;}
	__int16				GetParentType() const		{return m_parent_type;}
	bool				IsHasChild() const			{return !m_children.empty();}
	const D3DXVECTOR3&	GetPosition()				{return m_transformation_node.GetPosition();}
	//SceneObject*		GetParent()					{return m_parent;}
	bool				IsParentExist() const		{return m_parent_type != SCENE_OBJECT_TYPE_UNKNOWN;}
};

